package com.user.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import com.common.R;
import com.user.controller.vo.MenuVo;
import com.user.service.IMenu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: Member_Perks_Store
 * @description: 菜单控制层
 * @author: 无恙
 * @create: 2024-06-18 13:11
 **/
@RestController
@RequestMapping("/user/menu")
public class MenuController {

    @Autowired
    IMenu menuService;

    /*
     * @author 范铁凝
     * @date 2024/6/18
     * 获取菜单接口
     */

    @GetMapping(value = "/list/all",name = "菜单列表")
    @SaCheckPermission(value = {"menu:list"})
    @SaCheckRole(value = {"manager","admin","super_admin"},mode = SaMode.OR)
    @SaCheckLogin
    public R<List<MenuVo>> listAll(){
        List<MenuVo> menuVos = menuService.listByUid();
        return R.data(menuVos);
    }
}
